﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ManageTicket.Partner
{
    public partial class frmQuickSearchCustomer : Form
    {
        public frmQuickSearchCustomer(ArrayList arr)
        {
            InitializeComponent();
            arrSearchResult = arr;
        }

        ArrayList arrSearchResult;
        public ArrayList arrResult;

        private void frmQuickSearchCustomer_Load(object sender, EventArgs e)
        {
            lvwCustomer.Items.Clear();
            ListViewItem item;

            foreach (DataObjects.Customer oCus in arrSearchResult)
            {
                item = new ListViewItem();
                item.Text = oCus.CustomerId;
                item.SubItems.Add(oCus.CustomerName);
                lvwCustomer.Items.Add(item);
                lblCount.Text = "Tổng: " + lvwCustomer.Items.Count.ToString();
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            arrResult = new ArrayList();
            DataObjects.Customer oCus;
            foreach (ListViewItem item in lvwCustomer.CheckedItems)
            {
                oCus = new DataObjects.Customer();
                oCus.CustomerId = item.Text;
                oCus.CustomerName = item.SubItems[1].Text;
                arrResult.Add(oCus);
            }
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            arrResult = new ArrayList();
            this.Close();
        }
    }
}
